home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
BMUG Revelations
/
BMUG Revelations.toast
/
Programming
/
Programming Languages
/
Yerk 3.64
/
Asm source
/
BuildRegMask
< prev
next >
Wrap
Text File
|
1986-03-14
|
2KB
|
67 lines
\ BuildRegMask ReeseWarner 5/13
\ for MOVEM
\ 03/06/86 GDC fixed MOVEM
0 -> dlevel
operand exPtr
\ is first char in string = char?
: Char= { addr len char -- bool }
addr c@ char =
;
\ for / in MOVEM
: setReg { mode reg# flag work \ shift -- work }
flag
IF \ if regular mask
mode 8 * reg# + 1 swap << work or -> work
ELSE
mode 0=
IF
8 -> shift
ELSE
0 -> shift
THEN
8 reg# - ++> shift
1 shift 1- << work or -> work
THEN
work val" work is "
;
\ Flag indicates whether it is regular or pre-decrement
\ 1 = regular
\ 0 = predecrement
\ modes 0 data register
\ 1 address register
: BuildRegMask { opPtr flag \ tokentype work -- regMask }
0 -> work
BEGIN
nextToken -> tokentype \ if next token is , or eol then
get: token ascii , char= \ get out
tokentype eol = or not
WHILE
msg" in WHILE "
get: token ascii / char=
IF
msg" IT'S A / "
mode: opPtr reg: opPtr flag work setReg -> work
opPtr getOp
ELSE
msg" ITSA something else "
exPtr getOp
mode: opPtr mode: exPtr = not
IF
210 asmError
ELSE
reg: exPtr 1+ reg: opPtr
DO
mode: opPtr i flag work setReg -> work
LOOP
THEN
THEN
REPEAT
mode: opPtr reg: opPtr flag work setReg -> work
work
;